package com.link2room.blaster.MNSworker;

import com.aliyun.mns.model.Message;
import com.link2room.blaster.dto.param.base.BlasterBaseParamDto;
import com.link2room.blaster.facade.ISendMsgFacadeService;
import com.link2room.common.mns.Worker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 微信callback处理
 * Created by LN on 2016/9/18.
 */
@Component("messageLogWorker")
public class MessageLogWorker implements Worker{

    private static Logger logger = LoggerFactory.getLogger(MessageLogWorker.class);
    @Resource
    private ISendMsgFacadeService sendMsgFacadeService;
    @Override
    public boolean exec(Message message) throws Exception {
        String msgbody = message.getMessageBody();
        logger.debug("正在处理线程Tread:"+Thread.currentThread().getName()+" 的msgBody : \n"+ msgbody);
        BlasterBaseParamDto dto = new BlasterBaseParamDto();
        dto.setMsgBody(msgbody);
        return sendMsgFacadeService.msgCallbackHandle(dto);
    }
}
